from concurrent.futures.thread import ThreadPoolExecutor

import requests

from example11 import download_picture

with ThreadPoolExecutor(max_workers=16) as pool:
    channels = ('beauty', 'car', 'funny', 'photograph', 'food')
    for ch in channels:
        for num in range(1, 4):
            resp = requests.get(f'https://image.so.com/zjl?ch={ch}&sn={num * 30}')
            data_dict = resp.json()
            for beauty_dict in data_dict['list']:
                picture_url = beauty_dict['qhimg_url']
                pool.submit(download_picture, picture_url)
